package hust.music.action;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import hust.music.action.base.ActionBase;
import hust.music.service.IndexModService;
import hust.music.util.DynamicInfo;

/**
 * IndexAjaxAction
 * 
 * @author Txazo
 * @since 1.0
 */
@Controller
@Scope("session")
public class IndexAjaxAction extends ActionBase {

	private static final long serialVersionUID = 1L;

	/** 好友关系 */
	List<DynamicInfo> friend = new ArrayList<DynamicInfo>();
	/** 分享音乐 */
	List<DynamicInfo> music = new ArrayList<DynamicInfo>();
	/** 流派集 */
	List<DynamicInfo> playList = new ArrayList<DynamicInfo>();

	@Autowired
	private IndexModService indexModService;

	/**
	 * 首页
	 * 
	 * @return 逻辑视图
	 */
	public String index() {
		playList = indexModService.getRecentPlayList(0, 10);
		friend = indexModService.getRecentFriends(0, 10);
		music = indexModService.getRecentUploadMusic(0, 5);

		return "index";
	}

	public List<DynamicInfo> getFriend() {
		return friend;
	}

	public void setFriend(List<DynamicInfo> friend) {
		this.friend = friend;
	}

	public List<DynamicInfo> getMusic() {
		return music;
	}

	public void setMusic(List<DynamicInfo> music) {
		this.music = music;
	}

	public List<DynamicInfo> getPlayList() {
		return playList;
	}

	public void setPlayList(List<DynamicInfo> playList) {
		this.playList = playList;
	}

}
